<!--

    Copyright © 2016-2025 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<mat-toolbar class="transparent">
  <h2 translate>ai-models.check-connectivity</h2>
  <span class="flex-1"></span>
  <button mat-icon-button
          (click)="cancel()"
          type="button">
    <mat-icon class="material-icons">close</mat-icon>
  </button>
</mat-toolbar>
<div mat-dialog-content>
  <div class="flex h-full flex-1 flex-col items-center justify-center">
    <mat-progress-spinner color="warn" mode="indeterminate"
                          strokeWidth="5" *ngIf="!showCheckSuccess && !checkErrMsg">
    </mat-progress-spinner>
    <div *ngIf="showCheckSuccess">
      <div class="flex flex-1 items-center justify-center">
        <mat-icon class="success connection-icon">check_circle</mat-icon>
      </div>
      <span class="connection-status success">{{ "ai-models.check-connectivity-success" | translate }}</span>
    </div>
    <div *ngIf="checkErrMsg" class="w-full">
      <div class="flex flex-1 items-center justify-center">
        <mat-icon class="error connection-icon">cancel</mat-icon>
      </div>
      <div class="connection-status error">{{ "ai-models.check-connectivity-failed" | translate }}</div>
      <tb-json-object-edit class="json-editor"
        readonly
        [ngModel]="checkErrMsg">
      </tb-json-object-edit>
    </div>
  </div>
</div>
<div mat-dialog-actions class="justify-end">
  <button mat-button color="primary"
          type="button"
          [disabled]="(isLoading$ | async)"
          (click)="cancel()" cdkFocusInitial>
    {{ 'action.cancel' | translate }}
  </button>
</div>
